<?php

declare(strict_types=1);

namespace ImiApp\ApiServer\Api\Model\Base;

use Imi\Config\Annotation\ConfigValue;
use Imi\Model\Annotation\Column;
use Imi\Model\Annotation\DDL;
use Imi\Model\Annotation\Entity;
use Imi\Model\Annotation\Table;
use ImiApp\ImiServer\AbstractModel as Model;

/**
 * 浏览记录 基类.
 *
 * @Entity(camel=false, bean=true, incrUpdate=false)
 * @Table(name=@ConfigValue(name="@app.models.ImiApp\ApiServer\Api\Model\Viewlog.name", default="fa_viewlog"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.ImiApp\ApiServer\Api\Model\Viewlog.poolName"))
 * @DDL(sql="CREATE TABLE `fa_viewlog` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned DEFAULT NULL COMMENT '用户ID',
  `public_id` int(10) unsigned DEFAULT NULL COMMENT '公共ID',
  `viewstatus_id` int(10) unsigned DEFAULT NULL COMMENT '类型ID',
  `time` int(10) unsigned DEFAULT NULL COMMENT '时间',
  PRIMARY KEY (`id`),
  KEY `public_id` (`public_id`) USING BTREE,
  KEY `uid` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='浏览记录'", decode="")
 *
 * @property int|null $id 
 * @property int|null $userId 用户ID
 * @property int|null $publicId 公共ID
 * @property int|null $viewstatusId 类型ID
 * @property int|null $time 时间
 */
abstract class ViewlogBase extends Model
{
    /**
     * {@inheritdoc}
     */
    public const PRIMARY_KEY = 'id';

    /**
     * {@inheritdoc}
     */
    public const PRIMARY_KEYS = ["id"];

    /**
     * id.
     * @Column(name="id", type="int", length=10, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=0, isAutoIncrement=true, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $id = NULL;

    /**
     * 获取 id.
     *
     * @return int|null
     */
    public function getId(): ?int
    {
        return $this->id;
    }

    /**
     * 赋值 id.
     * @param int|null $id id
     * @return static
     */
    public function setId($id)
    {
        $this->id = null === $id ? null : (int)$id;
        return $this;
    }

    /**
     * 用户ID.
     * user_id
     * @Column(name="user_id", type="int", length=10, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $userId = NULL;

    /**
     * 获取 userId - 用户ID.
     *
     * @return int|null
     */
    public function getUserId(): ?int
    {
        return $this->userId;
    }

    /**
     * 赋值 userId - 用户ID.
     * @param int|null $userId user_id
     * @return static
     */
    public function setUserId($userId)
    {
        $this->userId = null === $userId ? null : (int)$userId;
        return $this;
    }

    /**
     * 公共ID.
     * public_id
     * @Column(name="public_id", type="int", length=10, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $publicId = NULL;

    /**
     * 获取 publicId - 公共ID.
     *
     * @return int|null
     */
    public function getPublicId(): ?int
    {
        return $this->publicId;
    }

    /**
     * 赋值 publicId - 公共ID.
     * @param int|null $publicId public_id
     * @return static
     */
    public function setPublicId($publicId)
    {
        $this->publicId = null === $publicId ? null : (int)$publicId;
        return $this;
    }

    /**
     * 类型ID.
     * viewstatus_id
     * @Column(name="viewstatus_id", type="int", length=10, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $viewstatusId = NULL;

    /**
     * 获取 viewstatusId - 类型ID.
     *
     * @return int|null
     */
    public function getViewstatusId(): ?int
    {
        return $this->viewstatusId;
    }

    /**
     * 赋值 viewstatusId - 类型ID.
     * @param int|null $viewstatusId viewstatus_id
     * @return static
     */
    public function setViewstatusId($viewstatusId)
    {
        $this->viewstatusId = null === $viewstatusId ? null : (int)$viewstatusId;
        return $this;
    }

    /**
     * 时间.
     * time
     * @Column(name="time", type="int", length=10, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $time = NULL;

    /**
     * 获取 time - 时间.
     *
     * @return int|null
     */
    public function getTime(): ?int
    {
        return $this->time;
    }

    /**
     * 赋值 time - 时间.
     * @param int|null $time time
     * @return static
     */
    public function setTime($time)
    {
        $this->time = null === $time ? null : (int)$time;
        return $this;
    }

}
